package com.itheima.api;


import com.itheima.dto.OmsCompanyAddressDto;
import com.itheima.mapper.OmsCompanyAddressMapper;
import com.itheima.pojo.OmsCompanyAddress;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 芝士雪豹
 * @create 2022/10/13/19:29
 */
@DubboService
public class OmsCompanyAddressApiImpl implements OmsCompanyAddressApi {
    @Autowired
    private OmsCompanyAddressMapper omsCompanyAddressMapper;

    @Override
    public OmsCompanyAddressDto findAllOrder() {
        OmsCompanyAddressDto dto = new OmsCompanyAddressDto();
        OmsCompanyAddress address = omsCompanyAddressMapper.findAllOrder();
        if (address == null) {
            dto.setCode(404);
            dto.setDate(null);
            dto.setMessage("暂无数据");
            return dto;
        }
        Map map = new HashMap<>();
        map.put("addressName",address.getAddressName());
        map.put("city",address.getCity());
        map.put("detailAddress",address.getDetailAddress());
        map.put("id",address.getId());
        map.put("name",address.getName());
        map.put("phone",address.getPhone());
        map.put("province",address.getProvince());
        map.put("receiveStatus",address.getReceiveStatus());
        map.put("region",address.getRegion());
        map.put("sendStatus",address.getSendStatus());
        dto.setDate(map);
        dto.setCode(200);
        dto.setMessage("查询成功");
        return dto;
    }
}
